<template>
    <div class="title">
        <el-card shadow="always" class="titles"> {{title}}</el-card>
        <div>
            <el-breadcrumb class="breadcrumb" separator="/">
                <el-breadcrumb-item v-for="route in $route.matched"  @click="changeTags(route)">
                  <span>{{ route.meta.title }}</span>
                </el-breadcrumb-item>
              </el-breadcrumb>
        </div>
        <div class="tabs">
            <el-tag 
            v-for="tag in list" 
            :key="tag.name" 
            class="mx-1" 
            closable  
            size="small" 
            :type="tag.type"
            @click="changeTags(tag)"
            @close="removeTags(tag)">
                {{ tag.meta.title }}
            </el-tag>
        </div>
    </div>
</template>

<script>
    import {
        mapState,
        mapMutations
    } from 'vuex'

    export default {
        computed: {
            ...mapState(['list','title','mbx'])
        },
        methods: {
            ...mapMutations(['changeList','removeList']),
            changeTags(obj){
                this.changeList(obj);
            },
            removeTags(obj){
                this.removeList(obj);
                
            },
        }
    }
</script>

<style scoped>
    .title {

        font-size: 25px;
        font-weight: 600;
        margin-bottom: 20px;
        overflow: hidden;
        display: flex;
    }

    .titles {
        width: 200px;
        height: 50px;
        background-color: rgb(40, 144, 255);
        color: rgb(255, 250, 255);
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .tabs {
        flex: 1;
        margin-left: 15px;
        display: flex;
        align-content: space-between;
        flex-wrap: wrap;
    }
    .mx-1{
        font-weight: 400;
        margin-right: 5px;
        cursor: pointer;
    }
    .breadcrumb{
        font-size: 18px;
        margin-left: 10px;
        display: flex;
        align-items: center;
        height: 100%;
        cursor: pointer;
    }
</style>